<?php defined('SYSPATH') or die('No direct script access.');

class Adminmenu {
	public $submenu_enable = TRUE;
	public static $menu = array(
				'控制面板' => array(
					array('title' => '控制板', 'uri' => 'dashboard/dashboard', 'role' => array('view' => 'view_dashboard')),
					//array('title' => '今日推荐', 'uri' => 'daily_rec', 'role' => array('view' => 'view_daily_rec'))
					),
				'链接' => array(
					array('title' => '链接管理', 'uri' => 'link/links', 'role' => array('view' => 'view_links', 'add' => 'add_links', 'edit' => 'edit_links', 'delete' => 'delete_links')),
					array('title' => '分类', 'uri' => 'category', 'role' => array('view' => 'view_category', 'add' => 'add_category', 'edit' => 'edit_category', 'delete' => 'delete_category')),
					array('title' => '标签', 'uri' => 'tag', 'role' => array('view' => 'view_tag', 'add' => 'add_tag', 'edit' => 'edit_tag', 'delete' => 'delete_tag'))
					),
				'组件' => array(
					),
				'媒体' => array(
					),
				'界面' => array(
					),
				'用户' => array(
					array('title' => '用户管理', 'uri' => 'user/users', 'role' => array('view' => 'view_users', 'add' => 'add_users', 'edit' => 'edit_users', 'delete' => 'delete_users')),
					array('title' => '我的资料', 'uri' => 'myprofile', 'role' => array('view' => 'view_myprofile', 'add' => 'add_myprofile', 'edit' => 'edit_myprofile', 'delete' => 'delete_myprofile'))
					),
				'设置' => array(
					array('title' => '基础资料设置', 'uri' => 'base_opt', 'role' => array('view' => 'view_base_opt', 'add' => 'add_base_opt', 'edit' => 'edit_base_opt', 'delete' => 'delete_base_opt'))
					),
				);
//show main menu
public static function instance()
{
	$rolemenu = self::$menu;//通过权限过滤的menu,还未做处理

		$output = '<div id="fishEyeList" ><ul>';
		foreach($rolemenu as $mainmenu_title => $submenu)
		{
			//显示各主菜单标题，链接为各主菜单的第一个子菜单uri

			if($submenu)
			{
				$uri = $submenu[0]['uri'];
				//$mainmenu_class = array( 'class' => 'mainmenu');
				$output .= "<li class='bounce'><h3><span class='mainmenu'  onclick=\"getmenu('" . $uri . "','" . $mainmenu_title . "');\">" . $mainmenu_title . "</span></h3><ul>";
				
				foreach($submenu as $leafmenu)
				{//显示所有子菜单

					$li_class = ' class='.$leafmenu['uri'];
					//$leafmenu_class = array( 'class' => 'leafmenu' );
					$output .= "<li ><span class='leafmenu'  onclick=\"getmenu('" . $leafmenu['uri'] . "','" . $leafmenu['title'] . "');\">" .  $leafmenu['title'] . '</span></li>';
				}
			}
			else
			{
				//$mainmenu_class = array( "class" => "mainmenu");
				$output .= "<li class='bounce'><h3><span class='mainmenu' >" .  $mainmenu_title . "</span></h3><ul>";
			}
			$output .= '</ul></li>';
		}
		$output .= '</ul></div>';
		
		return $output;
		
	}

} // End Adminmenu
